from django.db import models
from apps.common.base.models import BaseModel
import django.utils.timezone as timezone

class Activity(BaseModel):

    status = (
        ("INITIAL", "初始状态"),
        ("OPEN", "报名中"),
        ("APPLYEND", "报名结束"),
        ("CLOSE", "结束")
    )
    key = (
        ("upRank1", "直升级别一"),
        ("upRank2", "直升级别二"),
        ("upRank3", "直升级别三"),
        ("fx", "分销"),
        ("goldCustom", "黄金定制")
    )
    lessee = models.ForeignKey('system.Lessee', related_name="lessee_activity", verbose_name='租户', on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    key = models.CharField("活动标记", max_length=200, choices=key, blank=True, default='')
    name = models.CharField("活动名称", max_length=200, blank=True, default='')
    coverUrl = models.CharField("活动封面", max_length=200, blank=True, default='')
    activityIntr = models.TextField("活动介绍", max_length=5000, blank=True, default='')
    activityParams = models.TextField("活动参数", max_length=5000, blank=True, default='')
    price = models.DecimalField("活动显示价格", max_digits=10, decimal_places=2, default=0)
    fansPrice = models.DecimalField("粉丝购买价格", max_digits=10, decimal_places=2, default=0)
    memberPrice = models.DecimalField("会员购买价格", max_digits=10, decimal_places=2, default=0)
    startTime = models.DateTimeField('开始时间', blank=True, default=timezone.now)
    endTime = models.DateTimeField('结束时间', blank=True, default=timezone.now)
    lastTime = models.DateTimeField('报名截止时间', blank=True, default=timezone.now)
    status = models.CharField("状态", max_length=100, choices=status, default="INITIAL")

    class Meta:
        verbose_name = 'Activity'
        verbose_name_plural = verbose_name